package birdGame;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;

//柱子类 障碍物
public class column {

    BufferedImage image;
    int x;
    int y;
    int width;
    int height;

    public column() {
        try {
            image=ImageIO.read(getClass().getResource("column.png"));
            width=image.getWidth();
            height=image.getHeight();
            x=500;
            y= (int) (Math.random()*301-500);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    //柱子移动
    public void step() {
        x-=2;
        //判断当柱子出去则更新新的柱子产生
        if (x==-width) {
            x=500;
            y= (int) (Math.random()*301-500);
        }
    }

}
